//
//  HZL_travelNotesDetailLocationPageCollectionViewCell.m
//  B_Project
//
//  Created by 胡佳俊 on 15/11/28.
//  Copyright © 2015年 HZL. All rights reserved.
//

#import "HZL_travelNotesDetailLocationPageCollectionViewCell.h"

@interface HZL_travelNotesDetailLocationPageCollectionViewCell ()

@property (nonatomic, retain)UIImageView *img;

@end
@implementation HZL_travelNotesDetailLocationPageCollectionViewCell
- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        
        self.img = [[UIImageView alloc]init];
        self.img.contentMode = UIViewContentModeScaleAspectFill;
        self.img.clipsToBounds = YES;
        [self.contentView addSubview:self.img];

    }
    return self;
}

- (void)applyLayoutAttributes:(UICollectionViewLayoutAttributes *)layoutAttributes
{
    
    
    //夜间模式
    if ([[NSUserDefaults standardUserDefaults]boolForKey:@"isNight"]) {
        self.contentView.backgroundColor = [UIColor colorWithRed:0.28 green:0.28 blue:0.28 alpha:1];
        
        
    }else
    {
        self.contentView.backgroundColor = [UIColor colorWithRed:0.98 green:0.97 blue:0.93 alpha:1];
    }
    
    self.img.frame = CGRectMake(0, 0, layoutAttributes.frame.size.width, layoutAttributes.frame.size.height);
}

- (void)setModelWaypoints:(HZL_RecommendModel *)modelWaypoints
{
    if (_modelWaypoints != modelWaypoints) {
        _modelWaypoints = modelWaypoints;
    }
    [self.img sd_setImageWithURL:[NSURL URLWithString:modelWaypoints.photo] placeholderImage:[UIImage sd_animatedGIFNamed:@"load"]];
}

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
